<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/7/1
 * Time: 15:37
 */

class PdoService
{
    const PARAM_port = '3306';

    const PARAM_host='127.0.0.1';
    const PARAM_db_name='sma';
    const PARAM_user='root';
    const PARAM_db_pass='123456';

/*    const PARAM_host='150.109.12.63';
    const PARAM_db_name='smachain';
    const PARAM_user='smachain';
    const PARAM_db_pass='XPjTaxya8raKMkFG';*/

    /* const PARAM_host = '114.116.191.182';
     const PARAM_db_name = 'test_sma_com';
     const PARAM_user = 'test_sma_com';
     const PARAM_db_pass = 'N7ZGzyt3zFPpiE33';*/



    public $db;

    public function __construct()
    {
        //$this->db = new \PDO("mysql:host=".PdoService::PARAM_host.";dbname=".PdoService::PARAM_db_name.";charset=utf8","root","123456");
        $this->db = new \PDO("mysql:host=" . PdoService::PARAM_host . ";dbname=" . PdoService::PARAM_db_name . ";charset=utf8", PdoService::PARAM_user, PdoService::PARAM_db_pass);
    }


}


$pdo = new PdoService();
$name = trim($_POST['name']);
if(!$name){
    die();
}
$dataTime = date('Y-m-d H:i:s');
$data =
$sql = "insert into  nationality (name,en_name,create_time,update_time) value ( \"$name\" ,' ', \"$dataTime\" , \"$dataTime\")";
echo $sql;
$pdo->db->query($sql);

echo 'end';